import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
import tensorflow as tf
def tensorflow_demo():
    '''
    tensorflow的基本结构
    :return:
    '''
    a = 2
    b = 3
    c = a + b
    print('普通加法运算:',c)

    #tensorflow实现加法运算
    a_t = tf.constant(2)
    b_t = tf.constant(3)
    c_t = a_t + b_t
    print('tensorflow实现加法运算:',c_t)

    #开启会话
    with tf.compat.v1.Session() as sess:
         c_t_value = sess.run(c_t)
         print('c_t_value:',c_t_value)
    return None

def test_demo():
    '''
    显示显卡
    :return:
    '''
    #查看默认图
    #1.调用方法
    res = tf.config.list_physical_devices('GPU')
    print(res)
    return None

if __name__ == '__main__':
    (x, y), (x_test, y_test) = tf.keras.datasets.mnist .load_data()
    print(x.shape)
